import GCResponse from "../network/GCResponse";

export class StartGameResponse extends GCResponse {

    cost: number;

    parseResponse(payload: any): void {
        this.cost = payload.cost || 0;
    }
}

export class QuestionResponse extends GCResponse {

    pic: string;
    id: number;
    options: string[] = [];

    countdown?: number = 0;
    total?: number = 0;

    parseResponse(payload: any): void {
        this.id = payload.id;
        this.pic = payload.pic;

        this.options.length = 0;
        this.options = payload.options;

        this.countdown = payload.countdown || 0;
        this.total = payload.total;
    }
}

export class AnswerResponse extends GCResponse {

    right: number;
    isLast: number;
    award: number;

    parseResponse(payload: any): void {
        this.right = payload.right;
        this.isLast = payload.isLast;
        this.award = payload.award;
    }
}

export class SettleResponse extends GCResponse {
    hearts: number = 0;

    parseResponse(payload: any): void {
        this.hearts = payload.hearts;
    }
}

